package cn.javasm.service.base.impl;

import cn.javasm.mapper.base.MyMapper;
import cn.javasm.service.base.BaseBoundService;
import cn.javasm.service.base.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author:27chen
 * @className:BsaeServiceImpl
 * @dat:2023/10/24 10:59
 * @version:0.1
 * @since:jdk11
 */
public class BaseBoundServiceImpl<T> implements BaseBoundService<T> {
    @Autowired
    private MyMapper<T> myMapper;


    @Override
    public List search(QueryWrapper queryWrapper) {
        return myMapper.selectList(queryWrapper);
    }


    @Override
    public List<T> AllboundList() {

      return myMapper.selectList(null);
    }

    @Override
    public T findbonudByCode(Long prodCode) {
        return myMapper.selectById(prodCode);
    }

    @Override
    public int add(T t) {
        return myMapper.insert(t);
    }

    @Override
    public int update(T t) {
        return myMapper.updateById(t);
    }

    @Override
    public int deleteByCode(Long prodCode) {
        return myMapper.deleteById(prodCode);
    }

    @Override
    public int batchDeleteByCodes(List codes) {
        return myMapper.deleteBatchIds(codes);
    }
}
